using MemoryPack;

namespace Game {
	[MemoryPackable]
	public partial class AmmoItem : BaseInventoryItem<AmmoItem> {
		public AmmoType AmmoType;

		public AmmoItem() {
			ItemType = InventoryItemType.Ammo;
		}

		public override string ItemName {
			get {
				if ( _nameString == null ) {
					_nameString = $"ammo:{AmmoType}";
				}
				return _nameString;
			}
		}

		public override bool IsEqualKind(BaseInventoryItem item) {
			if ( !base.IsEqualKind(item) ) {
				return false;
			}
			var cast = (AmmoItem)item;
			if ( cast == null ) {
				return false;
			}
			if ( cast.AmmoType == AmmoType ) {
				return true;
			}
			return true;
		}

		protected override AmmoItem CreateCopy(int count) {
			var copy = base.CreateCopy(count);
			copy.AmmoType= AmmoType;
			return copy;
		}
	}
}
